/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package character_9;

/**
 *测试操作Comparable
 * @author Administrator
 */
public class Account implements Comparable<Account>{
    
    private String name;
    private String number;
    private int balance;

    public Account(String name, String number, int balance) {
        this.name = name;
        this.number = number;
        this.balance = balance;
    }
    
    @Override
    public String toString(){
        return String.format("Account(%s,%s,%d)", name,number,balance);
    }
    
    @Override
    public int compareTo(Account a){
        
        return this.balance - a.balance;
    }
    
}
